﻿using UnityEngine;
using System.Collections;

public class HotSystem : MonoBehaviour {
	private int hot;
	public int Hot
	{
		get{return hot;}
	}
	private int maxHot;
	public int MaxHot
	{
		set {maxHot = value;}
		get {return maxHot;}
	}
	public float Persent
	{
		get {return (float)Hot / (float)MaxHot;}
	}
	public PressJudgment jdg;

	// Use this for initialization
	void Start () {
		hot = 0;
		maxHot = 100;
		jdg.evtPrsJdg += new System.EventHandler<PrsJdgEventArgs> (OnInputJagement);
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	public void RaiseHot(int num)
	{
		hot += num;
		hot = hot > maxHot ? maxHot : hot;
	}

	public void SlumpHot(int num)
	{
		hot -= num;
		hot = hot < 0 ? 0 : hot;
	}

	public void OnInputJagement(object send, PrsJdgEventArgs args)
	{
		switch(args.jgRst)
		{
		case JageResult.Perfect:
			RaiseHot(3);
			break;
		case JageResult.Good:
			RaiseHot(0);
			break;
		case JageResult.Fail:
			SlumpHot(3);
			break;
		default:
			break;
		}
	}
}
